/*
 * Copyright 2016, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.architecture.blueprints.todoapp;

import com.example.android.architecture.blueprints.todoapp.addedittask.AddEditTaskContract;
import com.example.android.architecture.blueprints.todoapp.addedittask.AddEditTaskPresenter;
import com.example.android.architecture.blueprints.todoapp.data.Task;
import com.example.android.architecture.blueprints.todoapp.data.source.TasksRepository;
import com.example.android.architecture.blueprints.todoapp.util.schedulers.BaseSchedulerProvider;
import com.example.android.architecture.blueprints.todoapp.util.schedulers.ImmediateSchedulerProvider;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;

import rx.Observable;


import static org.mockito.Mockito.*;

/**
 * Unit tests for the implementation of {@link AddEditTaskPresenter}.
 */
public class Demo {

    @Before
    public void setupMocksAndView() {

    }

    @Test
    public void createPresenter_setsThePresenterToView() {
        List<String> list = mock(List.class);
        when(list.get(anyInt())).thenReturn("测试1","测试2");
        String result = list.get(0) + list.get(1);
        verify(list, times(2)).get(anyInt());
        Assert.assertEquals(result,"测试1测试2");

        Map<Integer,String> map = mock(Map.class);
        when(map.put(anyInt(),anyString())).thenReturn("hello");//anyString()替换成"hello"就会报错
        verify(map).put(eq(1), eq("world")); //eq("world")替换成"wor
    }


}
